'use strict';

module.exports = app => {
  const {
    STRING,
    INTEGER,
    TEXT
  } = app.Sequelize;

  const News = app.model.define('news', {
    news_id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    cy_id: INTEGER,
    news_title: STRING,
    news_cover: STRING,
    introduce: STRING,
    article: TEXT,
    created_at: INTEGER,
  });
  News.associate = () => {
    // associations can be defined here
    app.model.News.belongsTo(app.model.Classify, {
      foreignKey: 'cy_id'
    });
  };
  return News;
};